﻿Public Class TestEditor
    Dim LastKey As Integer
    Private Sub RichTextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles RichTextBox1.KeyDown
        LastKey = e.KeyCode
    End Sub
    Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
        RemoveHandler RichTextBox1.TextChanged, AddressOf RichTextBox1_TextChanged
        Dim OldPos As Integer = RichTextBox1.SelectionStart
        RichTextBox1.Rtf = debuggingform.RTFGenerator.GetHighlightRTF(RichTextBox1.Text)
        RichTextBox1.SelectionStart = OldPos
        debuggingform.RichTextBox2.Text = RichTextBox1.Rtf
        AddHandler RichTextBox1.TextChanged, AddressOf RichTextBox1_TextChanged
    End Sub
End Class